<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>回收收废员管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${s.base}/css/base/base.css?123456" media="all" /></head>
<body class="childrenBody">
<form class="layui-form">
	<blockquote class="layui-elem-quote quoteBox" id="tool">
		<div class="layui-inline">
			<label class="layui-input-inline">状态</label>
			<label class="layui-input-inline">
				<select name="status" id="status"></select>
			</label>
			<label class="layui-input-inline">昵称</label>
			<label class="layui-input-inline">
				<input type="text" class="layui-input" name="memberNickName" placeholder="请输入昵称" />
			</label>
			<a class="layui-btn search_btn" lay-submit="" lay-filter="seacherBtn">搜索</a>
			<a class="layui-btn layui-btn-normal countMoneyBtn" >设置</a>
		</div>
	</blockquote>
	<table id="entityList" lay-filter="entityList"></table>
</form>
<script type="text/html" id="entityBar">
	<a class="layui-btn cy-btnbg-edit layui-btn-sm" lay-event="edit">处理</a>
</script>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript">layui.use(['jquery', 'pageUtil', 'table', 'dialogUtil','dateUtil','upload'],
    function() {
        var $ = layui.jquery,
            dateUtil = layui.dateUtil,
            table = layui.table,
            dialogUtil = layui.dialogUtil,
			upload = layui.upload,
            pageUtil = layui.pageUtil;
        var tableIns = null;

        pageUtil.initDict("recovery_waste_member_status",
            function(dictData) {
                pageUtil.showDict($("#status"), pageUtil.aceeptDictContentList(dictData, "recovery_waste_member_status"), "请选择状态");
                var url = "/recoveryWasteMember/page";
                var cols = [{
                    type: 'checkbox',
                    fixed: 'left'
                },
                    {
                        type: 'numbers',
                        title: '序号'
                    },
                    {
                        field: 'memberNickName',
                        title: '用户昵称',
                        align: 'center'
                    },
                    {
                        field: 'name',
                        title: '姓名',
                        align: 'center'
                    },
                    {
                        field: 'phone',
                        title: '联系方式',
                        align: 'center'
                    },
					{field: 'cardImage', title: '身份证图片',align:'center', templet:function(d){
                            return "<img src='"+d.cardImage+"' style='width: 80px;height: 80px;'/>";
                        },width:100},
                    {
                        field: 'workStatus',
                        title: '工作经验',
                        align: 'center',
                        templet: function(d) {
                            if (d.workStatus == "1") {
                                return "有";
                            } else{
                                return "无";
                            }
                        }
                    },
                    {
                        field: 'address',
                        title: '现住址',
                        align: 'center'
                    },
                    {field: 'status', title: '状态',align:'center', templet:function(d){
                            return pageUtil.aceeptDictContentName(dictData,"recovery_waste_member_status",d.status);
                        }},
                    {
                        field: 'manageContent',
                        title: '审核原因',
                        align: 'center'
                    },
                    {
                        field: 'createTime',
                        title: '创建时间',
                        width: 190,
                        align: 'center',
                        templet: function(d) {
                            return dateUtil.formatDate(new Date(d.createTime), "yyyy-MM-dd HH:mm:ss");
                        }
                    },
                    {
                        title: '操作',
                        width: 120,
                        align: "center",
                        fixed: 'right',
                        templet: function (d) {
                            return '<a class="layui-btn cy-btnbg-edit layui-btn-sm" lay-event="del"> 设置 </a>';
                        }
                    }];
                tableIns = pageUtil.initDate(cols, url, true);
            });

        $(".countMoneyBtn").click(function(){
            // 获取所有的ids
            var checkStatus = layui.table.checkStatus('entityList').data;

            if(checkStatus.length == 0){
                layer.alert("请选择至少一个用户进行审核！")
                return false;
            }

            var ids = [];
            $.each(checkStatus,function(i,v){
                ids.push(v.id);
            });
            var idsStr = ids.join(",");
            var index = layer.open({
                type: 1,
                title:'审核',
                area: ['400px', 'auto'], //宽高
                btn:['确定','取消'],
                content: '<div style="height: 195px;padding: 15px !important;">'+
                '<form class="layui-form" action="">'+
                '<div class="layui-form-item layui-form-text" >'+
                '<div class="layui-input-line">'+
                '<select class="form-control" name="wasteStatus" lay-verify="required" id="wasteStatus"></select>'+
                '</div>'+
                '</div>'+
                '<div class="layui-form-item layui-form-text" >'+
                ' <textarea id="manageContent" style="width:369px;height: 135px;!important;"></textarea>'+
                '</div>'+
                '</form>'+
                '</div>'
                ,success:function(){
                    pageUtil.initDict("recovery_waste_member_status",
                        function(dictData) {
                            pageUtil.showDict($("#wasteStatus"), pageUtil.aceeptDictContentList(dictData, "recovery_waste_member_status"), "", "");
                        });
                }
                ,yes:function (){
                    var manageContent = $("#manageContent").val();
                    var wasteStatus = $("#wasteStatus").val();
                    if(manageContent == null || manageContent == ""){
                        dialogUtil.alert("请填写处理原因");
                        return false;
                    }
                    if(manageContent.length > 200){
                        dialogUtil.alert("处理原因不能超过100个字");
                        return false;
                    }
                    var params={
                        "ids":idsStr,
                        "status":wasteStatus,
                        "manageContent":manageContent
                    }
                    $.post("/recoveryWasteMember/updateStatus", params, function (result) {
                        layer.close(index);
                        if (result.code == "0") {
                            //操作成功
                            tableIns.reload();
                        } else {
                            //操作失败
                            dialogUtil.alert(result.msg);
                        }
                    }, "json");
                }
                ,btn2: function(index, layero){

                }
            });
        });

        table.on('tool(entityList)',
            function(obj) {
                var layEvent = obj.event,
                    data = obj.data;
                if (layEvent === 'del') {
                	var id = data.id;
					var index = layer.open({
						type: 1,
						title:'审核',
						area: ['400px', 'auto'], //宽高
						btn:['确定','取消'],
						content: '<div style="height: 195px;padding: 15px !important;">'+
								'<form class="layui-form" action="">'+
								'<div class="layui-form-item layui-form-text" >'+
								'<div class="layui-input-line">'+
								'<select class="form-control" name="wasteStatus" lay-verify="required" id="wasteStatus"></select>'+
								'</div>'+
								'</div>'+
								'<div class="layui-form-item layui-form-text" >'+
								' <textarea id="manageContent" style="width:369px;height: 135px;!important;"></textarea>'+
								'</div>'+
								'</form>'+
								'</div>'
						,success:function(){
							pageUtil.initDict("recovery_waste_member_status",
									function(dictData) {
										pageUtil.showDict($("#wasteStatus"), pageUtil.aceeptDictContentList(dictData, "recovery_waste_member_status"), "", "");
									});
						}
						,yes:function (){
							var manageContent = $("#manageContent").val();
							var wasteStatus = $("#wasteStatus").val();
							if(manageContent == null || manageContent == ""){
								dialogUtil.alert("请填写处理原因");
								return false;
							}
							if(manageContent.length > 200){
								dialogUtil.alert("处理原因不能超过100个字");
								return false;
							}
							var params={
								"ids":id,
								"status":wasteStatus,
								"manageContent":manageContent
							}
							$.post("/recoveryWasteMember/updateStatus", params, function (result) {
								layer.close(index);
								if (result.code == "0") {
									//操作成功
									tableIns.reload();
								} else {
									//操作失败
									dialogUtil.alert(result.msg);
								}
							}, "json");
						}
						,btn2: function(index, layero){

						}
					});
                }
            });
    })</script>
</body>

</html>